<?php if ($user): ?>
<?php

    // Fetch Friends count
    $attrs = $user.'/friends?access_token=';
    $url = $fb_graph_url . $attrs . $access_token;  
    $fb_friends_data = getJsonData($url);
    $friends_array = json_decode($fb_friends_data, true);
    $friends_count  = count($friends_array[data]);
    //echo $friends_count

    // Fetch Page Likes count
    $attrs = 'me/likes?access_token=';
    $url = $fb_graph_url . $attrs . $access_token;  
    $fb_likes_data = getJsonData($url);
    $likes_array = json_decode($fb_likes_data, true);
    $likes_count  = count($likes_array[data]);
    //echo $likes_count;

    // Fetch Albums count
    $attrs = $user.'/albums?access_token=';
    $url = $fb_graph_url . $attrs . $access_token;  
    $fb_albums_data = getJsonData($url);
    $albums_array = json_decode($fb_albums_data, true);
    $albums_count  = count($albums_array[data]);

    // Fetch Groups count
    $attrs = 'me/groups?access_token=';
    $url = $fb_graph_url . $attrs . $access_token;  
    $fb_groups_data = getJsonData($url);
    $groups_array = json_decode($fb_groups_data, true);
    $groups_count  = count($groups_array[data]);
    //echo $groups_count;

?>
<?php endif ?>
